<html>
<head>
    <meta charset="utf-8">
    <title>用户注册 - 数媒贴吧</title>
    <link rel="stylesheet" href="/statics/css/index.css">
    <link rel="stylesheet" href="/statics/css/common.css">
    <link rel="stylesheet" href="/statics/css/form.css">
</head>
<body>
<?php require_once './Views/common/header.tpl.php';?>
<div class="box">
    <div class="left">
       <div class="user-form">
           <h3>用户注册</h3>
           <form action="">
               <div class="user-from-item">
                   <label>用户名</label>
                   <input type="text" name="username">
               </div>
               <div class="user-from-item">
                   <label>密码</label>
                   <input type="password" name="password">
               </div>
               <div class="user-from-item">
                   <label>确认密码</label>
                   <input type="password" name="re_password">
               </div>
               <div class="error"></div>
               <div class="user-from-item">
                   <input type="submit"  class="submit" value="立即注册"/>
               </div>
           </form>
       </div>
    </div>
    <?php require_once './Views/common/right.tpl.php';?>
</div>
<div class="clear"></div>
<?php require_once './Views/common/footer.tpl.php';?>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    jQuery(function() {
        jQuery('.submit').click(function() {
            var params = jQuery('form').serialize();
            jQuery.post('/index.php?c=user&a=register', params, function(data) {
                if (data.status == 200) {
                    alert('注册成功，请登录');
                    window.location.href='/index.php?c=user&a=login'
                } else {
                    jQuery('.error').html(data.message);
                }
            }, 'json');
            return false;
        });
    })
</script>
</body>
</html>